package com.luoqiu.cinema.controller;

import com.luoqiu.cinema.common.PageParam;
import com.luoqiu.cinema.common.PageResult;
import com.luoqiu.cinema.common.Result;
import com.luoqiu.cinema.entity.MoviePlace;
import com.luoqiu.cinema.entity.UserInfo;
import com.luoqiu.cinema.service.ManageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class ManageController {

    @Resource
    private ManageService manageService;

    @PostMapping(value = "/user/list")
    public Result<PageResult<UserInfo>> list(@RequestBody PageParam pageParam) {
        return manageService.list(pageParam);
    }

    @GetMapping(value = "/user/del")
    public Result<String> del(Integer id) {
        return manageService.del(id);
    }

    /**
     * 影院列表
     * @param pageParam
     * @return
     */
    @PostMapping(value = "/place/list")
    public Result<PageResult<MoviePlace>> listP(@RequestBody PageParam pageParam) {
        return manageService.listP(pageParam);
    }

    /**
     * 添加修改影院
     * @param moviePlace
     * @return
     */
    @PostMapping(value = "/place/add")
    public Result<String> addP(@RequestBody MoviePlace moviePlace) {
        return manageService.addP(moviePlace);
    }

    @GetMapping("/place/del")
    public Result<String> delP(Integer id) {
        return manageService.delP(id);
    }
}
